﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Sockets;

namespace LoginServer
{
    public partial class ManagerUserConnection
    {
        bool CheckMaxConnect()
        {
            if (Users.Count == config.MAX_USER_CONNECTION)
                return false;
            return true;

        }
        bool CheckHasConnect(Socket client)
        {
            IPEndPoint endpoint = (IPEndPoint)client.RemoteEndPoint;
            foreach (object Value in Users.Values)
            {
                Socket item = (Socket)Value;
                IPEndPoint end = (IPEndPoint)item.RemoteEndPoint;
                if (end.Address == endpoint.Address)
                    return false;                
            }
            return true;
        }

    }
}
